home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre1.z / postgre1 / demo / set-up-1.temp < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.9 KB  |  123 lines

  1. /*
  2.  * $Header: /private/postgres/demo/RCS/set-up-1.temp,v 1.11 1992/07/23 05:05:37 mer Exp $
  3.  * script to set up the demo database
  4.  */
  5.  
  6. create person (name = char16, age = int4, location = point)
  7. \g
  8. create emp (salary = int4, manager = char16) inherits (person)
  9. \g
  10. create student (gpa = float8) inherits (person)
  11. \g
  12. create stud_emp (percent = int4) inherits (emp, student)
  13. \g
  14. define type city_budget ( internallength = 16, 
  15.               input = int44in, 
  16.               output = int44out, 
  17.               element = int4)
  18. \g
  19.  
  20. create city (name = char16, location = box, budget = city_budget)
  21. \g
  22.  
  23. define function circle_in (   language = "c",
  24.                            returntype = circle ) 
  25.   arg is (char16)
  26.   as "_CWD_/circle.o"
  27. \g
  28.  
  29. define function circle_out (   language = "c", 
  30.                    returntype = char16 ) 
  31.     arg is (circle)
  32.     as "_CWD_/circle.o"
  33. \g
  34. define function pt_in_circle (   language = "c",
  35.                  returntype = bool) 
  36.     arg is (point, circle)
  37.     as "_CWD_/circle.o"
  38. \g
  39.  
  40. define function overpaid (       language = "c",
  41.                  returntype = bool) 
  42.     arg is (emp)
  43.     as "_CWD_/overpaid.o"
  44. \g
  45. define type circle (internallength = 24, 
  46.             input = circle_in,
  47.             output = circle_out)
  48. \g
  49.  
  50. define function boxarea (   language = "c", 
  51.                 returntype = int4) 
  52.      arg is (box)
  53.      as "_CWD_/boxarea.o"
  54. \g
  55. load "_CWD_/boxarea.o"
  56. \g
  57. load "_CWD_/circle.o"
  58. \g
  59. load "_CWD_/overpaid.o"
  60. \g
  61.  
  62. append person (name = "mike", age = 40, location = "(3.1,6.2)")
  63. \g
  64.  
  65. append person (name = "joe", age = 20, location = "(5.5,2.5)")
  66. \g
  67.  
  68. append person (name = "greg", age = 50, location = "(5.0,2.0)")
  69. \g
  70.  
  71. append person (name = "bob", age = 18, location = "(0.0,0.0)")
  72. \g
  73.  
  74. append emp (name = "bill", age = 20, 
  75. location = "(11.0,10.0)", salary = 1000, manager = "sharon")
  76. \g
  77.  
  78. append emp (name = "sharon", age = 25, 
  79. location = "(15.0,12.0)", salary = 500, manager = "sam")
  80. \g
  81.  
  82. append emp (name = "sam", age = 30, 
  83. location = "(10.0,5.0)", salary = 300, manager = "bill")
  84. \g
  85.  
  86. append student (name = "fred", age = 28, location = "(3.1,-1.5)", gpa = 3.7)
  87. \g
  88.  
  89. append student (name = "larry", age = 60, location = "(21.8,4.9)", gpa = 3.1)
  90. \g
  91.  
  92. append stud_emp (name = "jeff", age = 23, 
  93. location = "(8.0,7.7)", salary = 600, manager = "sharon", gpa = 3.5)
  94. \g
  95.  
  96. append stud_emp (name = "cim", age = 30, location = "(10.5,4.7)", salary = 400, gpa = 3.4)
  97. \g
  98.  
  99. append stud_emp (name = "linda", age = 19, location = "(0.9,6.1)", salary = 100, gpa = 2.9)
  100. \g
  101.  
  102.  
  103. append city (name = "berkeley", location = "(0.0,0.0,10.0,10.0)", 
  104. budget = "250, 300, 325, 275")
  105. \g
  106.  
  107. append city (name = "oakland", location = "(-10.0,-10.0,0.0,5.0)",
  108. budget = "600, 400, 350, 500")
  109. \g
  110.  
  111. append city (name = "elcerrito", location = "(10.0,0.0, 20.0,10.0)",
  112. budget = "100, 100, 100, 100")
  113. \g
  114.  
  115. append city (name = "richmond", location = "(20.0,5.0, 35.0,15.0)",
  116. budget = "300, 320, 340, 360")
  117. \g
  118.  
  119. append city (name = "sanpablo", location = "(35.0,20.0,40.0,30.0)",
  120. budget = "50, 60, 65, 70")
  121. \g
  122.  
  123.